package p.ithorns.tools.translator.annotation.field;

import org.springframework.core.annotation.AliasFor;
import p.ithorns.tools.translator.annotation.Translatable;

import java.lang.annotation.*;

/**
 * SpEL表达式字段注解
 *
 * @author ithorns
 */
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Target({ElementType.FIELD})
@Translatable
@Inherited
public @interface ExpField {

    @AliasFor(annotation = Translatable.class)
    String from() default "";

    /**
     * 获取单个字典的EL表达式
     * 例: expr1 = "@testService.getName(#key)"
     * 方法实体形式: Object getDict(Serializable key)
     */
    String expr1();

    /**
     * 获取字典Map的EL表达式
     * 例: expr2 = "@testService.getNames(#keys)"
     * 方法实体形式: Map<T extends Serializable, Object> getDictMap(Set<T extends Serializable> keys)
     */
    String expr2();

}
